//
//  NotifacationTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/1.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "NotifacationTableViewCell.h"


@implementation NotifacationTableViewCell{
    GLGWImageView * logoImageView;
    GLGWLabel * accountLabel;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier theCellType:(CellListType)c_type{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        if (c_type == CellListType_Noyifition) {
            GLGWLabel * titlabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15), kHeightProportion_In_iPhoneTriploid(12), kWidthProportion_In_iPhoneTriploid(200), kHeightProportion_In_iPhoneTriploid(20)) theFont:SYSTEMFONT(14) theColor:kColor_Rule_Black inSuperView:self];
            titlabel.text = @"消息通知";
            //
            GLGWLabel * miaoshuLabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(titlabel.x, kY_With_View(titlabel, 5), titlabel.width, kHeightProportion_In_iPhoneTriploid(17)) theFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:self];
            miaoshuLabel.text = @"用于订单报价等通知";
        }else{
            logoImageView = [[GLGWImageView alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15), kHeightProportion_In_iPhoneTriploid(14), kWidthProportion_In_iPhoneTriploid(30), kHeightProportion_In_iPhoneTriploid(30)) inSuperView:self];
            logoImageView.backgroundColor = kRandomColor;
            //
            accountLabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(kX_With_View(logoImageView, 10), kHeightProportion_In_iPhoneTriploid(18), kWidthProportion_In_iPhoneTriploid(100), kHeightProportion_In_iPhoneTriploid(20)) theFont:SYSTEMFONT(14) theColor:kColor_Rule_Black inSuperView:self];
        }
        UISwitch * rightSwitch = [UISwitch new];
        [self.contentView addSubview:rightSwitch];
        [rightSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.contentView);
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(53)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(31)));
        }];
        rightSwitch.transform = CGAffineTransformMakeScale( 0.8, 0.8);//缩放
        [rightSwitch setOnTintColor:[UIColor colorWithHexString:@"#45DB5E"]];//
        [rightSwitch setThumbTintColor:[UIColor colorWithHexString:@"#F2F2F2"]];
        [rightSwitch addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventValueChanged];
    }
    return self;
}

-(void)switchAction:(UISwitch *)mySwitch{
    mySwitch.selected = !mySwitch.selected;
    if (self.Block_SwitchType) {
        self.Block_SwitchType(mySwitch.selected);
    }
}

//set
-(void)setRowNum:(NSInteger)rowNum{
    _rowNum = rowNum;
    if (_rowNum == 0) {
        accountLabel.text = @"QQ";
    }else{
        accountLabel.text = @"微信";
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
